1. Field of the Invention
The present invention relates to a system and a method for processing external data by a program language. More particularly, it relates to a system, a method, and a program for processing structured documents by the program language.
2. Description of the Related Art
The structured documents the representative of which is of XML (extensible Markup Language) are used in a variety of purposes. In particular, when the structured documents are used as a data-exchanging format between companies, the data needs to be processed using a program language.
Although the structured documents themselves have no other physical structure than strings of characters, the structured documents represent a structure by grammatical rules within the character strings. A syntax equipped with a start-tag and an end-tag is prepared, and the character string data is surrounded by these tags, thereby expressing an element included in the structured documents. Another element surrounded by a start-tag and an end-tag may be located inside the content of the surrounded character string data. This eventually represents a recursive nested-structure. This nested-structure is, logically, a tree structure. When viewing the nested-structured elements as the tree structure, the directly surrounded elements are defined as child nodes, and an element surrounding a child node directly is defined as a parent node, and the nodes sharing one and the same parent node are defined as brother nodes.
When manipulating such structured documents from a program language, there has existed no method for directly transcribing, into a structure of the program language, the tree-structured data included in the structured documents.
As a conventional technology, there has existed a method in which, after expanding the entire structured documents within a main storage as a tree structure where the respective elements are regarded as the nodes, this tree data structure is manipulated. For example, World Wide Web Consortium has recommended Document Object Model (http://www.w3.org/TR/REC-DOM-Level-1/), thus defining the various types of data-manipulating interfaces to the data structure expanded within the main storage as the tree structure.
Also, there exists a method in which, while scanning the structured documents, events are generated, thereby manipulating the structured documents in an event-driven manner. Namely, Simple API for XML (http://www.megginson.com/SAX/) had been developed in XML-DEV Mailing List, and has become the de-facto industry standard in processing the XML documents. In Simple API, while scanning the structured documents written in XML, the events are generated one after another for the encountered tags or the like, and the control is passed to a specific event-processing routine (which is referred to as “call back routine”), thereby making it possible to manipulate the structured documents.
In U.S. Pat. Nos. 6,085,196 and 6,279,015, there has been proposed an object-oriented system for mapping one structured information format to another structured information format. This system, however, has nothing to do with the program language processing system.
As will be explained below, there existed the following problem: When creating an application for processing the structured documents, creating the application is difficult with a program language that has no pointer-manipulating function or that has no function of registering the call back routine called up by an event.
Of the above-described prior arts, in the method of expanding the structured documents into the tree structure so as to manipulate the documents from a program language, the dynamical data structure is processed. For this reason, the language specification of the program language must include the pointer-manipulating function, or an object-reference manipulating function if the program language is an object-oriented language. Also, in the method of processing the structured documents in the event-driven scheme, the language specification of the program language must provide a unit for setting the call back routine called up for each event. Accordingly, with the above-described program language, e.g., the program language COBOL (JIS X 3002-1992, the computer program language COBOL) that, as the language specification, has no conceptions of the pointer for the data and of the pointer for the procedure routine, it is difficult to implement the programming in the event-driven scheme as well as the processing of the dynamical data structure.
It is an object of the present invention to provide a function of allowing the data included in the structured documents to be processed even in the program language that has no pointer-manipulating function or that has no function of registering the routine to be called up.